import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PersonnelAllocationVO, PersonnelAllocationForm, PersonnelAllocationQuery } from '@/api/zichanguanli/personnelAllocation/types';

/**
 * 查询物业人员配置列表
 * @param query
 * @returns {*}
 */

export const listPersonnelAllocation = (query?: PersonnelAllocationQuery): AxiosPromise<PersonnelAllocationVO[]> => {
  return request({
    url: '/zichanguanli/personnelAllocation/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询物业人员配置详细
 * @param id
 */
export const getPersonnelAllocation = (id: string | number): AxiosPromise<PersonnelAllocationVO> => {
  return request({
    url: '/zichanguanli/personnelAllocation/' + id,
    method: 'get'
  });
};

/**
 * 新增物业人员配置
 * @param data
 */
export const addPersonnelAllocation = (data: PersonnelAllocationForm) => {
  return request({
    url: '/zichanguanli/personnelAllocation',
    method: 'post',
    data: data
  });
};

/**
 * 修改物业人员配置
 * @param data
 */
export const updatePersonnelAllocation = (data: PersonnelAllocationForm) => {
  return request({
    url: '/zichanguanli/personnelAllocation',
    method: 'put',
    data: data
  });
};

/**
 * 删除物业人员配置
 * @param id
 */
export const delPersonnelAllocation = (id: string | number | Array<string | number>) => {
  return request({
    url: '/zichanguanli/personnelAllocation/' + id,
    method: 'delete'
  });
};
